package com.resource.controller;

import java.security.Principal;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.resource.service.HelloService;
import com.sinoframework.web.servlet.bean.SinoFailRuntimeException;

@RestController
@RequestMapping("hl")
public class HelloController {

	@Autowired
	private HelloService helloService;
	
	
	@RequestMapping("/hello")
    public String hello() {
        return this.helloService.hello();
    }
    
	@RequestMapping("/admin")
    public String admin() {
        return this.helloService.admin();
    }
    

    
	@RequestMapping("/getAge")
    public String getAge(Integer age) {
    	return this.helloService.getAge(age);
    }
    
	@RequestMapping("/emp")
    public Object emp(Principal principal) {
		return this.helloService.user();
    }
	
	
    //=========使用过滤注解===============
	@RequestMapping("/getAllUser")
    public List<String> getAllUser(Authentication principal) {
        return this.helloService.getAllUser();
    }
    
	@RequestMapping("/getAllAge")
    public void getAllAge(List<Integer> ages,List<String> users) {
    	this.helloService.getAllAge(ages, users);
    }

	
}
